package com.itheima.controller;

import com.github.pagehelper.PageInfo;
import com.itheima.pojo.Brand;
import com.itheima.service.BrandService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Slf4j
@RequestMapping("/brand")
public class BrandController {
    @Autowired
    private BrandService brandService;
    @PostMapping("/selectByPage")
    public PageInfo<Brand> selectByPage(int currentPage, int pageSize, @RequestBody Brand brand){
        PageInfo<Brand> brandPageInfo = brandService.selectByPage(currentPage, pageSize, brand);
        return brandPageInfo;
    }
    @PostMapping("/add")
    public void selectByPage( @RequestBody Brand brand){
        brandService.add(brand);
    }

    @PostMapping("/update")
    public void update( @RequestBody Brand brand){
        brandService.update(brand);
    }
    @PostMapping("/deleteByIds")
    public void deleteByIds(@RequestBody int[] ids){
        brandService.deleteByIds(ids);
    }

}
